{{extend "forums_layout.html"}}

{{block sub_menu}}
{{sub_menu(menu_items, 'forum')}}
{{end}}

{{block forum_nav}}
    <div class="nav">
        <a href="/forum" class="home" title="首页">论坛首页</a>
        <em>»</em>
        <span><a href="/forum/{{=forum.id}}">{{=forum.name}}</a></span>
    </div>
    <div class="tool">
        <a class="btn btn-green" href="/forum/{{=forum.id}}/new_topic">新主题</a>
    </div>
{{end}}

{{block content_main}}
<style>
    #field_subject {width:100%;}
</style>
{{use "xheditor"}}
<div class="content">
    <div class="box center">
        <h2>发表新主题</h2>
        <div class="box-body">
            {{<< form}}
        </div>
    </div>
</div>
{{include "inc_xheditor_plugins.html"}}
{{use "poshytip"}}
<script type="text/javascript">
    $(function(){
        $('textarea').xheditor({
            tools:'Cut,Copy,Paste,Pastetext,|,Blocktag,Fontface,FontSize,Bold,Italic,Underline,Strikethrough,FontColor,BackColor,SelectAll,Removeformat,|,Align,List,Outdent,Indent,|,Link,Unlink,Anchor,Img,Flash,Hr,Emot,Table,Code,Quote,|,About',
            skin:'vista',
            upLinkUrl:"!/forum/upload_file?forum_id={{=forum.id}}&slug={{=form.data['slug']}}",
            upFlashUrl:"!/forum/upload_file?forum_id={{=forum.id}}&slug={{=form.data['slug']}}",
            upFlashExt:"swf",
            upImgUrl:"!/forum/upload_image?forum_id={{=forum.id}}&slug={{=form.data['slug']}}",
            plugins:plugins,
            height:300
        });
        {{if not has_email:}}
            //设置poshytip关闭图片
            $.fn.poshytip.defaults.closeImage = '{{=url_for_static("jqutils/cross_grey_small.png")}}';
            var el = $('#field_reply_email').poshytip({
                className: 'tip-yellowsimple',
                content: '您尚未设置邮箱，将无法处理邮件',
                showOn: 'none',
                alignTo: 'target',
                alignX: 'inner-left',
                offsetX: 0,
                offsetY: 5,
                closeButton: true
            });
            el.poshytip('show');
        {{pass}}
    });
</script>
{{end}}
